package com.difsonapps.contacttranslator.service.impl;
import java.util.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.difsonapps.contacttranslator.dao.UserDAO;
import com.difsonapps.contacttranslator.dto.UserDTO;
import com.difsonapps.contacttranslator.service.itf.UserService;


@Service
@Transactional
public class UserServiceImpl implements UserService {

	@Autowired
	protected UserDAO userDAO;

	/* (non-Javadoc)
	 * @see com.diffogroup.languageforce.service.impl.UserService#insert(com.diffogroup.languageforce.dto.UserDTO)
	 */
	@Transactional
	public void insert(UserDTO userDTO){
		userDAO.insert(userDTO);
	}

	/* (non-Javadoc)
	 * @see com.diffogroup.languageforce.service.impl.UserService#update(com.diffogroup.languageforce.dto.UserDTO)
	 */
	@Transactional
	public void update(UserDTO userDTO){
		userDAO.update(userDTO);
	}

	/* (non-Javadoc)
	 * @see com.diffogroup.languageforce.service.impl.UserService#get(int)
	 */
	@Transactional
	public UserDTO get(int id) {
		return userDAO.get(id);
	}

	/* (non-Javadoc)
	 * @see com.diffogroup.languageforce.service.impl.UserService#getAll()
	 */
	@Transactional
	public List<UserDTO> getAll() {
		return userDAO.getAll();
	}

	/* (non-Javadoc)
	 * @see com.diffogroup.languageforce.service.impl.UserService#delete(com.diffogroup.languageforce.dto.UserDTO)
	 */
	@Transactional
	public void delete(UserDTO userDTO){
		userDAO.delete(userDTO);
	}

	public UserDTO getByEmail(String email) {
		return userDAO.getByEmail(email);
	}

	public UserDTO getByCode(String code) {
		
		return userDAO.getByCode(code);
	}

	public UserDTO getByEmailCode(String code, String email) {
		// TODO Auto-generated method stub
		return userDAO.getByEmailCode(code, email);
	}

	public UserDTO getByNumber(String number) {
		// TODO Auto-generated method stub
		return userDAO.getByNumber(number);
	}
	

	
}
